package com.seng.resourcetycoon.gui.views;

import com.seng.resourcetycoon.gui.controllers.TowerSetupItemController;
import com.seng.resourcetycoon.gui.models.ResourceTower;
import javafx.scene.control.ListCell;


public class TowerSetupCellView extends ListCell<ResourceTower> {

    public TowerSetupCellView() {

    }

    @Override
    public void updateItem(ResourceTower item, boolean empty) {
        super.updateItem(item, empty);

        if (empty || item == null) {
            // If this is an empty row
            setText(null);
            setGraphic(null);
            return;
        }
        setText(null);
        TowerSetupItemController towerSetupItemController = new TowerSetupItemController();
        setGraphic(towerSetupItemController.getContent());
        towerSetupItemController.bindData(item);
    }
}
